package main

import "fmt"

type Stack struct {
	items []int
}

func (s *Stack) push(item int) {
	s.items = append(s.items, item)
}

func (s *Stack) pop() int {

	if len(s.items) == 0 {
		return -1
	}

	lastIndex := len(s.items) - 1
	poped := s.items[lastIndex]
	s.items = s.items[:lastIndex]
	return poped
}

func main() {

	var s = Stack{}
	s.push(1)
	s.push(2)
	s.push(3)
	fmt.Println(s.pop())
	fmt.Println(s.pop())
	fmt.Println(s.pop())

	slice := make([]int, 3, 5)
	slice[0], slice[1], slice[2] = 2, 5, 6
	//b := slice
	//b[0] = 100

	b := append(slice, 8)
	fmt.Println(b)
	fmt.Println(slice)

}
